<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.3.1.min.js"></script>
    <script>
      $(function (){
        $("button").click(function (){
          $.get("http://localhost:8080/searchEmployee2?realname=" + $("input").val(),
          function (data) {
            console.log(data);
          });
        });
      });
    </script>
</head>
<body>
  <input >
  <button>search</button>
</body>
</html>